/**********************************************************************/
#include <QtGui/QApplication>
/**********************************************************************/
#include "mainframe.h"
#include "chatserver.h"

/**********************************************************************/
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainFrame w;
    ChatServer s;
    a.connect(&a, SIGNAL(lastWindowClosed()), SLOT(quit()));
    a.connect(&s, SIGNAL(error(QString)), &w,
              SLOT(displayError(QString)));
    a.connect(&s, SIGNAL(protocolMessage(QString)), &w,
              SLOT(printProtocolMessage(QString)));
    a.connect(&s, SIGNAL(clientAdded(QString)), &w,
              SLOT(addUser(QString)));
    a.connect(&s, SIGNAL(statusMessage(QString)), &w,
              SLOT(displayStatusMessage(QString)));
    a.connect(&w, SIGNAL(startServer(quint16)), &s,
              SLOT(start(quint16)));
    a.connect(&w, SIGNAL(stopServer()), &s,
              SLOT(stop()));
    w.show();
    return a.exec();
}
